<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateVideosTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('videos', function (Blueprint $table) {
            $table->increments('id')->comment('短视频表');
            $table->string('video_title', 255)->nullable()->comment('文章标题');
            $table->string('first_img', 255)->nullable()->comment('视频截图');
            $table->string('video_url', 255)->nullable()->comment('视频地址');
            $table->integer('read_num')->nullable()->comment('阅读次数')->default(0);
            $table->integer('zan_num')->nullable()->comment('点赞次数')->default(0);
            $table->integer('collect_num')->nullable()->comment('收藏次数')->default(0);
            $table->integer('like_num')->nullable()->comment('喜欢次数')->default(0);
            $table->integer('share_num')->nullable()->comment('分享次数')->default(0);
            $table->integer('category_id')->nullable()->comment('分类ID')->default(0);
            $table->tinyInteger('is_top')->nullable()->comment('置顶')->default(0);
            $table->integer('weight')->nullable()->comment('权重')->default(0);
            $table->integer('user_id')->nullable()->comment('用户作者ID')->default(0);
            $table->integer('admin_id')->nullable()->comment('管理员作者ID')->default(0);
            $table->tinyInteger('is_admin')->nullable()->comment('是否为管理员发布')->default(0);
            $table->integer('region_id')->nullable()->comment('所属地区ID（1.北洸村）')->default(0);
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('videos');
    }
}
